package com.zzy.ecommerce.dao;

import com.zzy.ecommerce.domain.Earn;
import com.zzy.ecommerce.domain.TEarn;

import java.util.List;

import org.apache.ibatis.annotations.*;

@Mapper
public interface TEarnMapper {
    @Insert("insert into t_earn(goodsId,userId,orderCount,finalPrice) values(#{goodsid},#{userid},#{orderid},#{finalprice})")
    Integer insertOneEarn(TEarn tEarn);

    @Select("select e.id,g.goodsName,u.username,e.orderCount,e.finalPrice from t_earn e join t_user u on e.userId=u.id join t_goods g on e.goodsId=g.goodsId")
    List<Earn> selectAllEarn();

    @Delete("delete from t_earn where id=#{id}")
    Integer deleteOneEarn(Integer id);

    @Delete("delete from t_earn")
    Integer deleteAllEarn();
}